# 核心代码类型
# 输入乱序数组，输出中位数
# 全过
class Solution:
    def median(self , arr ):
        # write code here
        length = len(arr)
        arr.sort()
        if length == 0:
            return []
        if length % 2 == 0:
            res = (arr[length//2 - 1] + arr[length // 2])/2
        else:
            res = arr[length // 2]
        return res

if __name__ == "__main__":
    arr = [1.0,3.0,2.0]
    a = Solution()
    print(a.median(arr))